from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from time import sleep
from options import options,service

url = r'http://172.16.22.105:8080/bsams/front/login.do'
driver = webdriver.Chrome(service=service,options=options)
driver.get(url)
sleep(2)




# 登入自动化脚本
driver.find_element(By.ID, 'taskId').send_keys('1')
driver.find_element(By.ID, 'loginName').send_keys('test01')
driver.find_element(By.ID, 'password').send_keys('123456')
driver.find_element(By.ID, 'vericode').send_keys('shtd')
sleep(2)
# 点击登入
driver.find_element(By.XPATH, '//*[@id="fmedit"]/div[2]/div[6]/input').click()
sleep(2)

# 资产管理查询
driver.find_element(By.XPATH, '//*[@id="leftmenu_asset_manage"]/div[1]/a/img').click()
sleep(2)
driver.find_element(By.ID, 'title').send_keys('惠普')
sleep(2)
driver.find_element(By.XPATH, '//*[@id="fmsearch"]/div[3]/button').click()

sleep(2)
driver.find_element(By.XPATH, '//*[@id="leftmenu_asset_storage"]/div[2]/a').click()
sleep(2)
driver.find_element(By.ID, 'title').send_keys('行政库房')
sleep(2)


ele = driver.find_element(By.ID, 'status')
Select(ele).select_by_value('1')
# driver.find_element(By.ID, 'title').send_keys('电脑材耗库')
sleep(2)
# 点击查看详情
driver.find_element(By.XPATH, '/html/body/div[2]/div[1]/div[2]/div[2]/div[2]/table/tbody/tr[2]/td[1]/div/a').click()
sleep(2)

driver.find_element(By.XPATH, '//*[@id="leftmenu_asset_provider"]/div[1]').click()
sleep(2)
# driver.find_element(By.XPATH, '//*[@id="cboxLoadedContent"]/div/div/div[2]/div[5]/a').click()
# # 点击供应商
# driver.find_element(By.XPATH, '//*[@id="leftmenu_asset_provider"]/div[1]/a/img').click()
# sleep(2)
# ele = driver.find_element(By.ID, 'status')
# Select(ele).select_by_value('1')
# sleep(2)

driver.quit()
